#ifndef _DELEGATE_H
#define _DELEGATE_H

#ifdef GALLIUMENGINE_DLL 
#define GALLIUMENGINE_API __declspec( dllexport )
#else
#define GALLIUMENGINE_API __declspec( dllimport )
#endif

namespace GalliumEngine
{

	#define EventHandler(thisType, handler, type)\
		class __E##handler##__ : public Delegate< type >\
		{\
			public:\
				__E##handler##__ ( thisType * obj )\
				: _obj(obj) {}\
				inline void operator()( type param )\
				{\
					_obj-> handler (param);\
				}\
				thisType * _obj;\
		};\
		__E##handler##__ E##handler;

	template <typename T>
	class Delegate
	{
	public:
		virtual void operator()(T param) = 0;
	};

}

#endif
